define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'xiservice/dividend/index' + location.search,
                    // add_url: 'xiservice/vip_order/add',
                    // edit_url: 'xiservice/vip_order/edit',
                    // del_url: 'xiservice/vip_order/del',
                    // multi_url: 'xiservice/vip_order/multi',
                    // import_url: 'xiservice/vip_order/import',
                    table: 'xiservice_dividend',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {field: 'id', title: __('Id')},
                        {field: 'user_id', title: __('User_id')},
                        {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
                        {field: 'source_order_no', title: __('Source_order_no'), operate: 'LIKE'},
                        {field: 'order_type', title: __('Order_type'), searchList: {"member":__('Member'),"service":__('Service')}, formatter: Table.api.formatter.normal},
                        {field: 'divide_rate', title: __('Divide_rate')},
                        {field: 'divide_money', title: __('Divide_total')},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
